﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace BUSINESS_OBJECT
{
    public class Custcls
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _CID = -99;
        private string _CUSTOMER_NAME = "";
        private string _COMPANY_NAME = "";
        private string _COMPANY_ADDRESS = "";
        private string _SERVICE_TYPE = "";
        private long _PHONE_NO = -99;
        private string _CC_TYPE = "";
        private DateTime _CC_EXR_DATE = Convert.ToDateTime( "1/1/1800");
        private long _CC_NUMBER = -99;
        private long _CC_PINCODE = -99;
        private string _EMAIL_ID = "";
        private string _CUSER_NAME = "";
        private string _CPASSWORD = "";
        private string _SECURITY_QUESTION = "";
        private string _ANSWER = "";
        private bool _ISDELETED = false;
        public bool ISDELETED
        {
            get
            {
                return _ISDELETED;
            }
            set
            {
                _ISDELETED = value;
            }
        }
        public long CID
        {
            get
            {
                return _CID;
            }
            set
            {
                _CID = value;
            }
        }
        public string CUSTOMER_NAME
        {
            get
            {
                return _CUSTOMER_NAME;
            }
            set
            {
                _CUSTOMER_NAME = value;
            }
        }
        public string COMPANY_NAME
        {
            get
            {
                return _COMPANY_NAME;
            }
            set
            {
                _COMPANY_NAME = value;
            }
        }
        public string COMPANY_ADDRESS
        {
            get
            {
                return _COMPANY_ADDRESS;
            }
            set
            {
                _COMPANY_ADDRESS = value;
            }
        }
        public string SERVICE_TYPE
        {
            get
            {
                return _SERVICE_TYPE;
            }
            set
            {
                _SERVICE_TYPE = value;
            }
        }
        public long PHONE_NO
        {
            get
            {
                return _PHONE_NO;
            }
            set
            {
                _PHONE_NO = value;
            }
        }
        public string CC_TYPE
        {
            get
            {
                return _CC_TYPE;
            }
            set
            {
                _CC_TYPE = value;
            }
        }
        public DateTime CC_EXR_DATE
        {
            get
            {
                return _CC_EXR_DATE;
            }
            set
            {
                _CC_EXR_DATE = value;
            }
        }
        public long CC_NUMBER
        {
            get
            {
                return _CC_NUMBER;
            }
            set
            {
                _CC_NUMBER = value;
            }
        }
        public long CC_PINCODE
        {
            get
            {
                return _CC_PINCODE;
            }
            set
            {
                _CC_PINCODE = value;
            }
        }
        public string EMAIL_ID
        {
            get
            {
                return _EMAIL_ID;
            }
            set
            {
                _EMAIL_ID = value;
            }
        }
        public string CUSER_NAME
        {
            get
            {
                return _CUSER_NAME;
            }
            set
            {
                _CUSER_NAME = value;
            }
        }
        public string CPASSWORD
        {
            get
            {
                return _CPASSWORD;
            }
            set
            {
                _CPASSWORD = value;
            }
        }
        public string SECURITY_QUESTION
        {
            get
            {
                return _SECURITY_QUESTION;
            }
            set
            {
                _SECURITY_QUESTION = value;
            }
        }
        public string ANSWER
        {
            get
            {
                return _ANSWER;
            }
            set
            {
                _ANSWER = value;
            }
        }

        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@CID", CID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@CUSTOMER_NAME", CUSTOMER_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@COMPANY_NAME", COMPANY_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@COMPANY_ADDRESS", COMPANY_ADDRESS, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@SERVICE_TYPE", SERVICE_TYPE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@PHONE_NO", PHONE_NO, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@CC_TYPE", CC_TYPE, DbType.String, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@CC_EXR_DATE", CC_EXR_DATE, DbType.DateTime, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@CC_NUMBER", CC_NUMBER, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam9 = DAC.Parameter("@CC_PINCODE", CC_PINCODE, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam10 = DAC.Parameter("@EMAIL_ID", EMAIL_ID, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam11 = DAC.Parameter("@CUSER_NAME", CUSER_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam12 = DAC.Parameter("@CPASSWORD", CPASSWORD, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam13 = DAC.Parameter("@SECURITY_QUESTION", SECURITY_QUESTION, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam14 = DAC.Parameter("@ANSWER", ANSWER, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam15 = DAC.Parameter("@ISDELETED", ISDELETED, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam9, dbparam10, dbparam11, dbparam12, dbparam13, dbparam14, dbparam15};
                return DAC.Save("CUSTOMER_SAVE", dbparamcall);
            }
            catch (Exception ex)
            {
              long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long CID, string CUSTOMER_NAME, string COMPANY_NAME, string COMPANY_ADDRESS, string SERVICE_TYPE, long PHONE_NO, string CC_TYPE, DateTime CC_EXR_DATE, long CC_NUMBER, string CC_PINCODE, string EMAIL_ID, string CUSER_NAME, string CPASSWORD, string SECURITY_QUESTION, string ANSWER,bool ISDELETED, string PARAANDOR)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@CID", CID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@CUSTOMER_NAME", CUSTOMER_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@COMPANY_NAME", COMPANY_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@COMPANY_ADDRESS", COMPANY_ADDRESS, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@SERVICE_TYPE", SERVICE_TYPE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@PHONE_NO", PHONE_NO, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@CC_TYPE", CC_TYPE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@CC_EXR_DATE", CC_EXR_DATE, DbType.DateTime, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@CC_NUMBER", CC_NUMBER, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam9 = DAC.Parameter("@CC_PINCODE", CC_PINCODE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam10 = DAC.Parameter("@EMAIL_ID", EMAIL_ID, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam11 = DAC.Parameter("@CUSER_NAME", CUSER_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam12 = DAC.Parameter("@CPASSWORD", CPASSWORD, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam13 = DAC.Parameter("@SECURITY_QUESTION", SECURITY_QUESTION, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam14 = DAC.Parameter("@ANSWER", ANSWER, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam15 = DAC.Parameter("@ISDELETED", ISDELETED, DbType.Boolean, ParameterDirection.Input);

                DbParameter dbparam16 = DAC.Parameter("@PARAANDOR", PARAANDOR, DbType.AnsiString, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam9, dbparam10, dbparam11, dbparam12, dbparam13,dbparam14,dbparam15,dbparam16};
                
                DataTable dt1 = DAC.Select("CUSTOMER_GET", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
    }

}
   
